package com.itheima.api.stub;

import com.itheima.api.OrderService;

public class OrderServiceStub implements OrderService {

    private final OrderService orderService;// proxy

    public OrderServiceStub(OrderService orderService) {
        this.orderService = orderService;
    }


    @Override
    public String getOrder(Long orderId) {
        //前置 后置 操作
        if (orderId == null) {
            return "参数不能未空";
        }
        try {
            String result = orderService.getOrder(orderId);//真正发起网络调用
            System.out.println(result);
            return result;
        } catch (Exception e) {
            return "stub exception ";
        }
    }
}
